package com.snail.model.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Document(indexName = "biz_product")
public class Product {
    @Id
    //keyword类型：不进行分词，直接存储
    @Field(name="product_id", type = FieldType.Keyword)
    @JsonProperty("product_id")
    private String productId;
    //text类型：进行分词，存储分词后的结果
    @Field(name="sell_user_id",type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    @JsonProperty("sell_user_id")
    private String sellUserId;
    @Field(name="product_name",type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    @JsonProperty("product_name")
    private String productName;
    @Field(name="price",type = FieldType.Text)
    private String price;
    @Field(name="status",type = FieldType.Text)
    private String status;
    @Field(name="main_image",type = FieldType.Text)
    @JsonProperty("main_image")
    private String mainImage;
    @Field(name="create_time",type = FieldType.Text)
    @JsonProperty("create_time")
    private String createTime;
    @Field(name="update_time",type = FieldType.Text)
    @JsonProperty("update_time")
    private String updateTime;
    @Field(name="deleted",type = FieldType.Text)
    private String deleted;
    @Field(name="detail_image",type = FieldType.Text)
    @JsonProperty("detail_image")
    private String detailImage;
    @Field(name="category_id",type = FieldType.Text)
    @JsonProperty("category_id")
    private String categoryId;
    @Field(name="description",type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String description;
    @Field(name="sale",type = FieldType.Text)
    private String sale;
}
